package com.itboye.textileexpes.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.textileexpes.beans.GoodsBean;
import com.itboye.textileexpes.beans.PayWayBean;
import com.itboye.textileexpes.interfaces.IGoods;
import com.itboye.textileexpes.interfaces.IMyOrder;
import com.itboye.textileexpes.interfaces.IPayWay;
import com.itboye.textileexpes.repository.GoodsRepository;
import com.itboye.textileexpes.repository.PayWayRepository;
import com.itboye.textileexpres.base.BasePresenter;
import com.itboye.textileexpres.base.ResultEntity;

public class PayWayPresenter extends BasePresenter implements
		IPayWay<PayWayBean> {
	public static final String getSuccessEvent = MainPresenter.class.getName()
			+ "_get_success";
	public static final String getFailureEvent = MainPresenter.class.getName()
			+ "_get_failure";

	public PayWayPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(PayWayBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(PayWayBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(PayWayBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(PayWayBean model) {
		// TODO Auto-generated method stub
		IPayWay<PayWayBean> payWay = new PayWayRepository(new ICompleteListener() {

			@Override
			public void success(ResultEntity result) {
				// TODO Auto-generated method stub
				result.setEventTag(Tag_Success);
				result.setEventType(getSuccessEvent);
				setChanged();
				notifyObservers(result);
			}

			@Override
			public void failure(ResultEntity result) {
				// TODO Auto-generated method stub
				result.setEventTag(Tag_Success);
				result.setEventType(getFailureEvent);
				setChanged();
				notifyObservers(result);

			}
		});
		payWay.getInfo(model);
	}

	@Override
	public List<PayWayBean> query(PayWayBean model) {
		// TODO Auto-generated method stub
		return null;
	}

}
